$(function(){
	$("tr").not(":first").mouseover(function(){
	     $(this).css("background","gray");
	});
	$("tr").mouseout(function(){
	     $(this).removeAttr("style");
	});
	
	$(".viewBill").on("click",function(){
		var obj = $(this);
		window.location.href=path+"/bill.do?method=view&billid="+ obj.attr("billid");
	});
	
	$(".modifyBill").on("click",function(){
		var obj = $(this);
		window.location.href=path+"/bill.do?method=modify&billid="+ obj.attr("billid");
	});
	
	$(".deleteBill").on("click",function(){
		var obj = $(this);
		if(confirm("你确定要删除订单@"+obj.attr("billcc")+"@吗？")){
			$.ajax({
				type:"GET",
				url:path+"/bill.do",
				data:{method:"delbill",billid:obj.attr("billid")},
				dataType:"json",
				success:function(data){
					if(data.delResult == "true"){
						alert("删除成功");
						obj.parents("tr").remove();
					}else if(data.delResult == "false"){//删除失败
						alert("对不起，删除订单@"+obj.attr("billcc")+"@失败");
					}else if(data.delResult == "notexist"){
						alert("对不起，订单@"+obj.attr("billcc")+"@不存在");
					}
				},
				error:function(data){
					alert("对不起，删除失败");
				}
			});
		}
		
	});
});